<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %>

<%@ page import="com.liferay.portal.kernel.language.LanguageUtil" %>
<%@ page import="com.liferay.portal.kernel.util.Constants" %>
<%@ page import="com.liferay.portal.kernel.util.GetterUtil" %>
<%@ page import="com.liferay.portal.kernel.util.ParamUtil" %>
<%@ page import="com.liferay.portal.kernel.util.StringBundler" %>
<%@ page import="com.liferay.portal.kernel.util.StringPool" %>
<%@ page import="com.liferay.portal.kernel.util.Validator" %>
<%@ page import="com.liferay.portlet.PortletPreferencesFactoryUtil" %>

<%@ page import="javax.portlet.PortletPreferences" %>

<portlet:defineObjects />

<%
	PortletPreferences preferences = renderRequest.getPreferences();
	
	String portletResource = ParamUtil.getString(request, "portletResource");
	
	if (Validator.isNotNull(portletResource)) {
		preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);
	}
	
	boolean autoplay = GetterUtil.getBoolean(preferences.getValue("autoplay", "false"));
	boolean enableFullscreen = GetterUtil.getBoolean(preferences.getValue("enableFullscreen", "false"));
	boolean showTitle = GetterUtil.getBoolean(preferences.getValue("showTitle", "true"));
	boolean showByline = GetterUtil.getBoolean(preferences.getValue("showByline", "true"));
	boolean showPortrait = GetterUtil.getBoolean(preferences.getValue("showPortrait", "true"));
	boolean enableEnhancedGenieMenu = GetterUtil.getBoolean(preferences.getValue("enableEnhancedGenieMenu", "false"));
	boolean enableKeyboardControls = GetterUtil.getBoolean(preferences.getValue("enableKeyboardControls", "true"));
	boolean enableRelatedVideos = GetterUtil.getBoolean(preferences.getValue("enableRelatedVideos", "false"));
	boolean enableSearch = GetterUtil.getBoolean(preferences.getValue("enableSearch", "false"));
	boolean hd = GetterUtil.getBoolean(preferences.getValue("hd", "false"));
	boolean loop = GetterUtil.getBoolean(preferences.getValue("loop", "false"));
	boolean showInfo = GetterUtil.getBoolean(preferences.getValue("showInfo", "true"));
	boolean showThickerBorder = GetterUtil.getBoolean(preferences.getValue("showThickerBorder", "false"));
	
	int annotations = GetterUtil.getInteger(preferences.getValue("annotations", StringPool.BLANK), 1);
	int closedCaptioning = GetterUtil.getInteger(preferences.getValue("closedCaptioning", StringPool.BLANK), 0);
	
	String height = preferences.getValue("height", "360");
	String playerColor = preferences.getValue("playerColor", StringPool.BLANK);
	String url = preferences.getValue("url", StringPool.BLANK);
	String width = preferences.getValue("width", "480");
	String videoFrom = preferences.getValue("videoFrom", StringPool.BLANK);
	String enableFullscreenBinary = enableFullscreen ? "1" : "0";
	String playerColorHex = playerColor.replaceAll("#", "").toLowerCase();
	String presetSize = width + "x" + height;
	String showTitleBinary = showTitle ? "1" : "0";	
	String showBylineBinary = showByline ? "1" : "0";
	String showPortraitBinary = showPortrait ? "1" : "0";
	String borderColor = preferences.getValue("borderColor", StringPool.BLANK);
	String startTime = preferences.getValue("startTime", StringPool.BLANK);
	String borderColorHex = "0x" + borderColor.replaceAll("#", "").replaceAll("^(.)(.)(.)$", "$1$1$2$2$3$3").toLowerCase();
%>